package com.fxb.project.exam.three;

import javax.swing.*;
import java.awt.*;

public class Test28 {
    public static void main(String[] args) {
        MyFrame frame = new MyFrame();
    }

}

class MyFrame extends JFrame{
    public MyFrame(){
        setTitle("Test28");
        setSize(300,200);
        getContentPane().add(new MyPanel());
        setVisible(true);
    }
}

class MyPanel extends JPanel{
    Image myImage;
    public void paintComponent(Graphics g){
        g.setColor(Color.green);
        g.drawLine(100,50,30,50);
        g.setColor(Color.red);
        g.drawRect(100,50,100,46);
    }
}
